package org.com.repair.DTO;

import java.util.Date;
import java.util.List;
import java.util.Set;

import org.com.repair.entity.Feedback;
import org.com.repair.entity.Material;
import org.com.repair.entity.RepairOrder;
import org.com.repair.entity.RepairOrder.RepairStatus;
import org.com.repair.entity.Technician;
import org.com.repair.entity.User;
import org.com.repair.entity.Vehicle;

public record RepairOrderResponse(
    Long id,
    String orderNumber,
    RepairStatus status,
    String description,
    Date createdAt,
    Date updatedAt,
    Date completedAt,
    Double laborCost,
    Double materialCost,
    Double totalCost,
    Long userId,
    Long vehicleId,
    User user,
    Vehicle vehicle,
    Set<Technician> technicians,
    List<Material> materials,
    List<Feedback> feedbacks
) {
    public RepairOrderResponse(RepairOrder repairOrder) {
        this(repairOrder.getId(), repairOrder.getOrderNumber(), repairOrder.getStatus(), 
             repairOrder.getDescription(), repairOrder.getCreatedAt(), repairOrder.getUpdatedAt(), 
             repairOrder.getCompletedAt(), repairOrder.getLaborCost(), repairOrder.getMaterialCost(),
             repairOrder.getTotalCost(), 
             repairOrder.getUser() != null ? repairOrder.getUser().getId() : null,
             repairOrder.getVehicle() != null ? repairOrder.getVehicle().getId() : null,
             repairOrder.getUser(), repairOrder.getVehicle(),
             repairOrder.getTechnicians(), repairOrder.getMaterials(), repairOrder.getFeedbacks());
    }
} 